<?php

namespace App\Models\Renew\RenewOrder;

use App\Models\BaseModel;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

class RenewDeferOperateHistoryModel extends BaseModel
{
    protected $table = "renew_defer_operate_history";


    const STATUS_0    = 0;
    const STATUS_1    = 1;
    const STATUS_2    = 2;
    const STATUS_TEXT = [
        self::STATUS_0 => "正常",
        self::STATUS_1 => "签署续签单合同关闭",
        self::STATUS_2 => "续签延期到期关闭",
    ];

    /**
     * 获取延期最后一条记录
     *
     * @param int $shopCode
     * @return Builder|Model|object|null
     */
    public static function getLastDeferHistoryByShopCode(int $shopCode)
    {
        return self::query()->where("shopCode", $shopCode)->orderBy("id", "desc")->first();
    }
}
